/*

This file is part of roomyak.

Copyright (C) 2008 Pixecur Technologies Incorporated (Esotera).
Visit Esotera at http://www.esoteras3.com
 
roomyak is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
 
roomyak is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with roomyak; see the file COPYING.  If not, write to 
Pixecur Technologies, 213-31 Peet Street, St. John's, NL, A1B 3W8. 
 
Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
 
*/

package tests.com.datasentinel.util.win32;

import java.awt.Image;
import java.awt.image.RenderedImage;
import java.io.File;

import javax.imageio.ImageIO;

import org.junit.Test;

import com.datasentinel.util.win32.Win32Thumbnailer;

public class Win32Thumbnailer_Test
{
	
	@Test
	public void getThumbnail()
	{

//		java.util.concurrent.atomic.AtomicInteger a;
//		a.
 		
//			WString s =  new WString("d:\\Temp\\upload\\a b\\Bear 10.wmv");
//			WString s =  new WString("d:\\Temp\\upload\\Readme 25.txt");
			//WString s =  new WString("d:\\Temp\\upload\\video.dvr-ms");
			//CLibrary.INSTANCE.OpenFileInDefaultEditor(s);
			//Thread.sleep(10000);
			
//			WString fileAbsolutePath =  new WString("C:\\Temp\\7594-4386.jpg");
//			WString fileAbsolutePath =  new WString("d:\\Temp\\upload\\Readme 25.txt");
//			WString fileAbsolutePath =  new WString("d:\\Temp\\upload\\a b\\Bear 10.wmv");
//			WString fileAbsolutePath =  new WString("c:\\Temp\\test_ab.odt");
//			WString fileAbsolutePath =  new WString("c:\\Temp\\intro_gm.pdf");
//			WString fileAbsolutePath =  new WString("c:\\Temp\\cherep.txt");
//			WString fileAbsolutePath =  new WString("c:\\Temp\\test_ab.doc");
//			WString fileAbsolutePath =  new WString("D:\\Pictures\\Cool\\japan\\010_heiwa4126.jpg");
			
//		System.setProperty("jna.library.path", "D:\\Projects\\C\\VCPP\\dataSentinel\\Win32Utils\\Release\\");
//			
//		try
//		{
//			URI uri = Win32Helper.class.getResource("Win32Utils.dll").toURI();
//			
//			System.setProperty("jna.library.path", uri.toString());
//		}
//		catch (URISyntaxException e1)
//		{
//			e1.printStackTrace();
//		}
		
		System.err.println("syspath=" + System.getProperty("jna.library.path"));
		System.err.println("syspath=" + System.getProperty("java.library.path"));
		
		Win32Thumbnailer thumbnailer = new Win32Thumbnailer();
		try{
			Image ans = thumbnailer.getSmallThumbnail(new File("c:\\Temp\\test_ab4.xls"));
			
			if(ans != null)
			{
				try
				{
					ImageIO.write((RenderedImage)ans, "PNG" , new File("c:\\temp\\Output_java.png"));
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}
